package com.caijin.common.core.domain.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;

import java.io.Serializable;

import com.caijin.common.core.domain.vo.DepartmentVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * <p>
 * 院系专业表
 * </p>
 *
 * @author Peas
 * @since 2021-01-13
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("tb_department")
@ApiModel(value = "Department对象", description = "院系专业表")
public class Department implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "主键，自增，唯一标识")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "院系或专业名称")
    private String name;

    @ApiModelProperty(value = "专业对应的院系id")
    private Long parentId;

    public DepartmentVO toVO() {
        DepartmentVO departmentVO = new DepartmentVO();

        departmentVO.setValue(this.id);
        departmentVO.setLabel(this.name);
        departmentVO.setParentId(this.parentId);

        return departmentVO;
    }

}
